home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / cmdp72d.zip / CMDPOST.CP$ < prev    next >
Text File  |  1992-03-19  |  47KB  |  1,312 lines

  1. ; Define addon menu   USER menus should go into CMDUSER.CPM...by convention...
  2. #NextFile CMDUSER.CPM
  3.  
  4.  
  5. ; CmdPost menu    initialization code
  6.  
  7.         ; Initialize a few variables here. 
  8.         Sounds(0)  ;Turn sounds off awhile
  9.         a=Version()
  10.         CP="CmdPost"
  11.         CPDIR=DirHome()
  12.         cr=strcat(num2char(13),num2char(10))
  13.         crlf=cr
  14.         cpini="WWW-PROD.INI"
  15.         tab=num2char(9)
  16.         Editor=inireadpvt(CP,"Editor","Notepad.exe",cpini)
  17.         CopyMoveDefault=""
  18.         if (NetGetCaps(2)==0) then MenuChange("FileNetwork",@DISABLE)
  19.  
  20.  
  21. ; Setting up the View menu item here.
  22.         a=inireadpvt(CP,"ViewSetup","NO",cpini)
  23.         if a=="NO" then goto DEFSETUP
  24.  
  25.         ViewShortLong=inireadpvt(CP,"ViewShortLong","SHORT",cpini)
  26.  
  27.         if ViewShortLong=="SHORT" then MenuChange("ViewShort",@CHECK)
  28.         if ViewShortLong=="LONG" then MenuChange("ViewLong",@CHECK)
  29.         
  30.         ViewBy=inireadpvt(CP,"ViewBy","NAME",cpini)
  31.         if ViewBy=="NAME" then MenuChange("ViewByName",@CHECK)
  32.         if ViewBy=="DATE" then MenuChange("ViewByDate",@CHECK)
  33.         if ViewBy=="SIZE" then MenuChange("ViewBySize",@CHECK)
  34.         if ViewBy=="KIND" then MenuChange("ViewByKind",@CHECK)
  35.         if ViewBy=="UNSORTED" then MenuChange("ViewUnsorted",@CHECK)
  36.  
  37.         ViewWhat=inireadpvt(CP,"ViewWhat","ALL",cpini)
  38.         if ViewWhat=="ALL" then MenuChange("ViewAll",@CHECK)
  39.         if ViewWhat=="PARTIAL" then MenuChange("ViewPartial",@CHECK)
  40.         if ViewWhat=="PROGRAMS" then MenuChange("ViewPrograms",@CHECK)
  41.  
  42.         SD3="*.*"
  43.         if ViewWhat=="PROGRAMS" then SD3="*.EXE *.COM *.BAT *.PIF"
  44.         if ViewWhat=="PARTIAL" then SD3=inireadpvt(CP,"Partial","*.*",cpini)
  45.         SetDisplay(ViewShortLong,ViewBy,SD3)
  46.         drop(ViewShortLong,ViewBy,ViewWhat,SD3)
  47.         goto PRINTSETUP
  48.  
  49.         :DEFSETUP
  50.         SetDisplay("SHORT","NAME","*.*")
  51.         MenuChange("ViewAll",@CHECK)
  52.         MenuChange("ViewByName",@CHECK)
  53.         MenuChange("ViewShort",@CHECK)
  54.  
  55. ; Start clock/blanker - Win 3.0 only
  56.        if (WinVersion(@MAJOR)==3 && WinVersion(@MINOR)>=10) then goto PRINTSETUP
  57. ; Setup Screen Blank Time.  Get time from win.ini
  58.         a=inireadpvt(CP,"BlankTime",5,cpini)
  59.         if a!=9999 then run("%CPDIR%cp_blnk.exe",a)
  60. ;                             ;    <0....blanking with no clock
  61. ;                             ;     0... no blanking, but have a clock
  62. ;                             ;    >0... blanking and clock
  63. ;                             ;    9999  Don't even run it.
  64.  
  65. ; Setup Print menu item...Kill it if no text printer
  66.         :PRINTSETUP
  67.         MenuChange("FilePrint", (inireadpvt(CP,"TextPrinter","",cpini)=="NONE") *@DISABLE)
  68.         
  69.         if IsRunning() then goto goombye
  70.         a=inireadpvt(CP,"AutoStart","NO",cpini)
  71.         if a!="YES" then goto goombye
  72.  
  73.         ;if Display(3,"Auto Startup","Hit any key to bypass WIN.INI%CR%Run= and Load= processing") then goto goombye
  74.         
  75.         a=iniread("windows","load","")
  76.         b=ItemCount(a," ")
  77.         d=0
  78.         :woop1
  79.         if d==b then goto dorun
  80.         d=d+1
  81.         c=ItemExtract(d,a," ")
  82.         Runicon(c,"")
  83.         goto woop1
  84.         
  85.         :dorun
  86.         a=iniread("windows","run","")
  87.         b=ItemCount(a," ")
  88.         d=0
  89.         :woop2
  90.         if d==b then goto goombye
  91.         d=d+1
  92.         c=ItemExtract(d,a," ")
  93.         Run(c,"")
  94.         goto woop2
  95.  
  96.         :goombye
  97.         Sounds(1) ;Sounds on
  98.         drop(a,b,c,d)
  99.  
  100. ; And the main menu starts.  
  101. &File
  102.  &Run...
  103.         r=CurrentFile()
  104.         if !IsKeyDown(@SHIFT) then r=askline("RUN","Enter file to run",r)
  105.         r=strcat(strtrim(r)," ")
  106.         i=strindex(r," ",0,@FWDSCAN)
  107.         a=strsub(r,1,i-1)
  108.         b=strtrim(strsub(r,i,strlen(r)-i+1))
  109.         run("%a%","%b%")
  110.         drop(a,b,r,i)        
  111.  &Load...
  112.         r=CurrentFile()
  113.         if !IsKeyDown(@SHIFT) then l=askline("LOAD","Enter file to load",CurrentFile())
  114.         l=strcat(strtrim(l)," ")
  115.         i=strindex(l," ",0,@FWDSCAN)
  116.         a=strsub(r,1,i-1)
  117.         b=strtrim(strsub(r,i,strlen(r)-i+1))
  118.         runicon("%a%","%b%")
  119.         drop(a,b,i,l)
  120.  Bro&wse...   \ {F3}
  121.         l=CurrentFile()
  122.         ;if !IsKeyDown(@SHIFT) then l=strtrim(askline("Browse","Enter file to browse",l))
  123.         run("%CPDIR%browser.exe",l)
  124.         drop(a,l)
  125.  &Edit...    \ {F4}
  126.         l=CurrentFile()
  127.         ;if !IsKeyDown(@SHIFT) then l=askline("Edit","Enter file to edit",l)
  128.         if l=="" || l==" " then goto NULL
  129.         a=strscan(l,".\",0,@BACKSCAN)
  130.         if a==0 then l=strcat(l,".")
  131.         if a==0 then goto NULL
  132.         if strsub(l,a,1)!="." then l=strcat(l,".")
  133.      :NULL
  134.         run(Editor,strtrim(l))
  135.         drop(a,b,l)
  136.  &Copy... \ {F8} 
  137.         r=OtherDir()
  138.         if r!=DirGet() then goto NEXT
  139.         if CopyMoveDefault!="" then r=CopyMoveDefault
  140.         :NEXT
  141.         s=strcat(DirItemize("")," ",FileItemize(""))
  142.         terminate(strlen(s)==1,"Copy Error","No files selected")
  143.         if !IsKeyDown(@SHIFT) then r=strtrim(askline("Copy",StrCat(s,CR,CR,"to"),r))
  144.         terminate(r=="","Copy Error","Cannot copy to null file name")        
  145.         q=strindex(r,"\",0,@FWDSCAN) ; Directory Name in there??
  146.         CopyMoveDefault=r
  147.         if q==0 then SetDisplay("","","") ;Nope. Set flag to update directory
  148.         FileCopy(s,r,@TRUE)
  149.         OtherUpdate()
  150.         drop(r,s,q)
  151.  &Move/Rename...  \  {F7}
  152.         r=OtherDir()
  153.         if r!=DirGet() then goto NEXT
  154.         if CopyMoveDefault!="" then r=CopyMoveDefault
  155.         :NEXT
  156.         s=strcat(DirItemize("")," ",FileItemize(""))
  157.         terminate(strlen(s)==1,"Move Error","No files selected")
  158.         if !IsKeyDown(@SHIFT) then r=strtrim(askline("Move",StrCat(s,CR,CR,"to"),r))
  159.         terminate(r=="","Move Error","Cannot move to null file name")
  160.         SetDisplay("","","") ;Set flag to update directory
  161.         CopyMoveDefault=r
  162.         FileMove(s,r,@TRUE)
  163.         OtherUpdate()
  164.         drop(r,s)
  165.  &Delete File... \ {DEL}
  166.         f=FileItemize("")
  167.         if IsKeyDown(@SHIFT) then goto doit
  168.         g=FileSize(f)
  169.         i=ItemCount(f," ")
  170.         terminate(strlen(f)==0,"delete","No files specified")
  171.         if askyesno("Delete %i% files:  %g% bytes ",f)==@NO then exit
  172.         :doit
  173.         SetDisplay("","","") ;Set flag to update directory
  174.         FileDelete(f)
  175.         OtherUpdate()  ; Well if the "other" CmdPost Window points to the
  176.                     ; same directory, it *IS* nice...
  177.         drop(f,g,b)
  178.  
  179.  &Print...
  180.         s=FileItemize("")
  181.         terminate(strlen(s)==0,"Print Error","No files selected")
  182.         TextPrinter=inireadpvt(CP,"TextPrinter","ASK",cpini)
  183.         if TextPrinter!="ASK" then goto NOASK1
  184.         r=AskYesNo("Attention",strcat("This print routine only works with standard printers.",CR,"Do you have a standard (NON-Postscript) printer?"))
  185.         if r==@YES then goto ASK1
  186.         iniwritepvt(CP,"TextPrinter","NONE",cpini)
  187.         MenuChange("FilePrint",@DISABLE)
  188.         Exit
  189.         :ASK1
  190.         TextPrinter="NONE|LPT1|LPT2|LPT3"
  191.         TextPrinter=ItemSelect("Choose the STD text printer",TextPrinter,"|")
  192.         terminate(strlen(TextPrinter)==0,"Error","Nothing chosen")
  193.         iniwritepvt(CP,"TextPrinter",TextPrinter,cpini)
  194.         :NOASK1
  195.         Terminate(TextPrinter=="NONE","ERROR","No Text Printers on system")
  196.         a=AskLine("Print",strcat(s,CR,CR,"to"),TextPrinter)
  197.         FileCopy(s,a,@FALSE)
  198.         
  199.  _File &Info
  200.         a=FileItemize("")
  201.         if a=="" then a=FileItemize("*.*")
  202.         tot=FileSize(a)
  203.         c=ItemCount(a," ") 
  204.         n=0
  205.         b=""
  206.         :loop
  207.         if n==c then goto show
  208.         n=n+1
  209.         a1=StrFix(ItemExtract(n,a," ")," ",14)
  210.         a2=FileSize(a1)
  211.         a3=FileTimeGet(a1)
  212.         a4=FileAttrGet(a1)
  213.         b=strcat(b,a1,tab,a2,tab,a3,tab,a4,"|")
  214.         goto loop
  215.         :show
  216.         ItemSelect("Total Size=%tot%",b,"|")
  217.         :cancel
  218.         drop(a,tot,c,n,a1,a2,a3,a4,b)
  219.         
  220.  &Freespace on Local Drives   
  221.  
  222.         Drive=DiskScan(2)     ; 2 is the code for local hard drives
  223.         Dmax=strlen(Drive)
  224.         DIndex=1
  225.         TotalSize=0
  226.         DriveReport=""
  227.  
  228.         :COUNTSPACE
  229.         NextDrive=StrSub(Drive,Dindex,1)
  230.         a=DiskFree(NextDrive)/1024
  231.         TotalSize=a+TotalSize
  232.         DriveReport=strcat(DriveReport,NextDrive," = ",a,"K","@")
  233.         DIndex=Dindex+3  ;each entry is 3 bytes long
  234.         if DIndex<=Dmax then goto COUNTSPACE
  235.         ItemSelect("Total Space Available = %TotalSize%K",DriveReport,"@")
  236.         Drop(xxx,TotalSize,DriveReport,NextDrive,LastDrive)
  237.                    
  238.  _E&xit Windows \ ^X
  239.         EndSession()
  240.         
  241.  |Find file
  242.   On DOS Path
  243.          a=AskLine("Locate file in path","Enter file name to locate",CurrentFile())
  244.          b=FileLocate(a)
  245.          terminate(b=="",a,"File Not Located")
  246.          if AskYesNo(b,"File Located.%CR%Change to that directory?")==@NO then exit
  247.          DirChange(FilePath(b))
  248.          SetDisplay("","","")
  249.   On Current Drive
  250.         Mask=Askline("Find File on drive","Enter file name to locate","*.bak")
  251.         FileList=""
  252.         tot=0
  253.         totdir=0
  254.         DirChange("\")
  255.         LocalList=FileItemize(Mask)
  256.         if LocalList=="" then goto skip11
  257.         tot = FileSize(LocalList)
  258.         totdir=1
  259.         LocalList=strcat(" ",strsub(LocalList,1,strlen(LocalList)-1))
  260.         locdir=DirGet()
  261.         LocalList=strreplace(LocalList," "," %locdir%")
  262.         FileList=LocalList
  263.         Drop(LocalList)
  264.         :Skip11
  265.         level=1
  266.         dir1=DirGet()
  267.         sub1 = DirItemize("*.*")
  268.         numdir1 = ItemCount(sub1, " ")
  269.         index1 = 0
  270.   
  271.         :loop
  272.         If index%level% == numdir%level% Then Goto upalevel
  273.         index%level% = index%level% + 1
  274.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  275.         LocDir = DirGet()
  276.         LocalList=FileItemize(Mask)
  277.         if LocalList=="" then goto skip22
  278.         totdir=totdir+1
  279.         tot = tot + FileSize(LocalList)
  280.         LocalList=strcat(" ",strsub(LocalList,1,strlen(LocalList)-1))
  281.         LocalList=strreplace(LocalList," "," %locdir%")
  282.         FileList=Strcat(FileList,LocalList)
  283.         drop(LocalList)
  284.         :skip22
  285.         level = level + 1
  286.         dir%level%=LocDir
  287.         sub%level% = DirItemize("*.*")
  288.         numdir%level% = ItemCount(sub%level%, " ")
  289.         index%level% = 0
  290.         goto loop
  291.   
  292.         :upalevel
  293.         drop(dir%level%,sub%level%,index%level%,numdir%level%)
  294.         level=level-1
  295.         if level!=0 then goto loop
  296.  
  297.         :done
  298.         ; -----------
  299.         ; Termination
  300.         ; -----------
  301.         If StrLen(tot) < 9 Then tot = StrCat(StrFill("", 9 - StrLen(tot)), tot)
  302.         tot = StrCat(StrSub(tot,1,3),",",StrSub(tot,4,3),",",StrSub(tot,7,3))
  303.         tot = StrTrim(tot)
  304.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  305.         tot = StrTrim(tot)
  306.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  307.         tot = StrTrim(tot)
  308.         if FileList!="" then FileList=Strsub(FileList,2,strlen(FileList)-1)
  309.         level=ItemCount(FileList," ")
  310.         SelectedFile=ItemSelect("%totdir% SubDirs.  %level% Files. %tot% bytes.",FileList," ")
  311.         if SelectedFile=="" then goto GOOMBYE
  312.         DirChange(FilePath(SelectedFile))
  313.         SetDisplay("","","")
  314.         :GOOMBYE
  315.         drop(tot,level,totdir,FileList,SelectedFile)
  316.         
  317.  _&Hilite Files
  318.   By Names
  319.         a=AskLine("Hilite Files","Enter types of files to hilite",strcat("*.",FileExtension(CurrentFile())))
  320.         FileHilite(a,@TRUE)
  321.   By Attribute
  322.         :askagain
  323.         a="Enter an attribute to hilite. R A S  or H"
  324.         b="Use CAPS to hilite if attribute is set,"
  325.         c="Use lowercase to hilite if not set."
  326.         a=strcat(a,CR,b,CR,c,CR,"Enter only one character. R A S or H")
  327.         drop(b,c)
  328.         a=AskLine("Hilite by Attribute",a,"A")
  329.         if strlen(a)!=1 then goto askagain
  330.         case=2
  331.         if (a=='R' || a=='A' || a=='S' || a=='H') then case=1
  332.         if (a=='r' || a=='a' || a=='s' || a=='h') then case=0
  333.         a=strupper(a)
  334.         if case==2 then goto askagain
  335.         d=FileItemize("*.*")
  336.         e=ItemCount(d," ")
  337.         f=0
  338.         :loop
  339.         f=f+1
  340.         if f>e then exit
  341.         q=ItemExtract(f,d," ")
  342.         g=FileAttrGet(q)
  343.         h=strscan(g,a,1,@FWDSCAN)
  344.         if h>0 then h=1
  345.         ;display(3,"%a% %h%","%q% %g%:
  346.         if case==h then filehilite(q,@TRUE)
  347.         ;beep 
  348.         goto loop
  349.  &Unhilite Files
  350.   By Name
  351.         a=AskLine("Unhilite Files","Enter types of files to unhilite",strcat("*.",FileExtension(CurrentFile())))
  352.         FileHilite(a,@FALSE)
  353.   By Attribute
  354.         :askagain
  355.         a="Enter an attribute to hilite. R A S  or H"
  356.         b="Use CAPS to hilite if attribute is set,"
  357.         c="Use lowercase to hilite if not set."
  358.         a=strcat(a,CR,b,CR,c,CR,"Enter only one character. R A S or H")
  359.         drop(b,c)
  360.         a=AskLine("Hilite by Attribute",a,"A")
  361.         if strlen(a)!=1 then goto askagain
  362.         case=2
  363.         if (a=='R' || a=='A' || a=='S' || a=='H') then case=1
  364.         if (a=='r' || a=='a' || a=='s' || a=='h') then case=0
  365.         a=strupper(a)
  366.         if case==2 then goto askagain
  367.         d=FileItemize("*.*")
  368.         e=ItemCount(d," ")
  369.         f=0
  370.         :loop
  371.         f=f+1
  372.         if f>e then exit
  373.         q=ItemExtract(f,d," ")
  374.         g=FileAttrGet(q)
  375.         h=strscan(g,a,1,@FWDSCAN)
  376.         if h>0 then h=1
  377.         ;display(3,"%a% %h%","%q% %g%:
  378.         if case==h then filehilite(q,@FALSE)
  379.         ;beep 
  380.         goto loop
  381.  
  382.  _File Attributes
  383.   View/Modify current file
  384.         DaFile=CurrentFile()
  385.         :REDO
  386.         attr=FileAttrGet(DaFile)
  387.         RD=2
  388.         AR=2
  389.         SY=2
  390.         HD=2
  391.         if strsub(attr,1,1)=="R" then  RD=1
  392.         if strsub(attr,2,1)=="A" then  AR=1
  393.         if strsub(attr,3,1)=="S" then  SY=1
  394.         if strsub(attr,4,1)=="H" then  HD=1
  395.         OldHD=HD
  396.         OldSY=SY
  397.         b=@YES
  398.         DialogBox("View/Modify Attributes","cp_attr2.dlg")
  399.         If OldHD!=HD then b=AskYesNo("Attribute Changer","Note: Changing Hidden attribute is unusual%CR%Continue?")
  400.         if b==@NO then goto REDO
  401.         If OldSy!=SY then b=AskYesNo("Attribute Changer","Note: Changing System attribute is unusual%CR%Continue?")
  402.         if b==@NO then goto REDO
  403.         attr=""
  404.         if RD==1 then attr="R"
  405.         if RD==2 then attr='r'
  406.         if AR==1 then attr=strcat(attr,"A")
  407.         if AR==2 then attr=strcat(attr,"a")
  408.         if HD==1 then attr=strcat(attr,"H")
  409.         if HD==2 then attr=strcat(attr,"h")
  410.         if SY==1 then attr=strcat(attr,"S")
  411.         if SY==2 then attr=strcat(attr,"s")
  412.         FileAttrSet(DaFile,attr)
  413.         SetDisplay("","","")
  414.         
  415.  
  416.   Change hilited files
  417.         a=FileItemize("")
  418.         terminate(a=="","Attribute Changer","No files Hilited")
  419.         string=a
  420.         if strlen(string)<35 then goto REDO
  421.         string=strcat(strfix(string," ",35)," ...")
  422.         :REDO
  423.         RD=3
  424.         AR=3
  425.         SY=3
  426.         HD=3
  427.         b=@YES
  428.         DialogBox("Attribute Changer","cp_attr1.dlg")        
  429.         If HD!=3 then b=AskYesNo("Attribute Changer","Note: Changing Hidden attribute is unusual%CR%Continue?")
  430.         if b==@NO then goto REDO
  431.         If SY!=3 then b=AskYesNo("Attribute Changer","Note: Changing System attribute is unusual%CR%Continue?")
  432.         if b==@NO then goto REDO
  433.         attr=""
  434.         if RD==1 then attr="R"
  435.         if RD==2 then attr='r'
  436.         if AR==1 then attr=strcat(attr,"A")
  437.         if AR==2 then attr=strcat(attr,"a")
  438.         if HD==1 then attr=strcat(attr,"H")
  439.         if HD==2 then attr=strcat(attr,"h")
  440.         if SY==1 then attr=strcat(attr,"S")
  441.         if SY==2 then attr=strcat(attr,"s")
  442.         FileAttrSet(a,attr)
  443.         SetDisplay("","","")
  444.  
  445.  
  446.         
  447.  _Floppy Space
  448.   A:
  449.         message(strcat("Drive A ",DiskFree("A")),strcat("Selected Files ",FileSize(FileItemize(""))))
  450.   B:
  451.         message(strcat("Drive B ",DiskFree("B")),strcat("Selected Files ",FileSize(FileItemize(""))))
  452.  
  453.  _&Network
  454.   Connect Drive to Net
  455.          AvailDrive=DiskScan(0)
  456.          DrvLen=strlen(AvailDrive)
  457.          if DrvLen==0 then goto NOMORE
  458.          AvailDrive=Strsub(AvailDrive,DrvLen-2,2)
  459.          NetPath=NetBrowse(0)
  460.          pswd=AskPassword("Enter password for",NetPath)
  461.          NetAddCon(NetPath,pswd,AvailDrive)
  462.          exit
  463.          :NOMORE
  464.          Message("Connect Drive to Net","No drives avail for assignment")
  465.          
  466.          
  467.   Disconnect
  468.          AvailDrive=DiskScan(4)
  469.          a=Itemcount(AvailDrive," ")
  470.          if a==0 then exit
  471.          i=1
  472.          DisList=""
  473.          :loop
  474.          b=ItemExtract(i,AvailDrive," ")
  475.          DisList=strcat(b,num2char(9),NetGetCon(b),"|")
  476.          i=i+1
  477.          if i<a then goto loop
  478.          AvailDrive=ItemSelect("Disconnect",DisList,"|")
  479.          NetCancelCon(AvailDrive,0)
  480.   Net Dialog
  481.          NetDialog()         
  482.          
  483.          
  484.  _&Extensions...
  485.         a=strtrim(CurrentFile())
  486.         i=strindex(a,".",0,@FWDSCAN)
  487.         terminate(i==0,"Association Error","Associated files must have an extension")
  488.         b=FileExtension(a)
  489.         c=iniread("extensions",b,"???.EXE ^.%b%")
  490.         d=askline("Associate","%b% files are associated with",c)
  491.         terminate(c==d,"","")
  492.         iniwrite("extensions",b,d)
  493.         
  494. &Dir
  495.  Create Director&y...
  496.         a=askline("Create Directory","Enter directory to create",DirGet())
  497.         terminate(a=="","Create Error","Cannot create directory with null name")
  498.         DirMake(strtrim(a))
  499.         SetDisplay("","","")
  500.         drop(a)
  501.  
  502.  &Rename Directory...
  503.         a=DirItemize("")
  504.         terminate(ItemCount(a," ")!=1,"Rename Error","Zero or more than one dir specified")
  505.         b=strtrim(AskLine("Rename Directory","Enter new directory name for %a%",a))
  506.         terminate(a==b || b=="","Rename Error","Illegal name change specified")
  507.         DirRename(strtrim(a),b)
  508.         SetDisplay("","","")
  509.         OtherUpdate()
  510.         drop(a,b)
  511.  
  512.  &Kill Directory...
  513.         f=DirItemize("")
  514.         terminate(strlen(f)==0,"Delete Directory","No directory specified")
  515.         ;terminate(@no==askyesno("Delete Directory",f),"Delete Directory","Directory not deleted")
  516.         DirRemove(strtrim(f))
  517.         SetDisplay("","","")
  518.         OtherUpdate()   ; Well if the "other" CmdPost Window points to the
  519.                       ; same directory, it *is* nice
  520.         drop(f)
  521.  
  522.  &Change Directory...
  523.         a=DirGet()
  524.         b=strindex(a,':',1,@fwdscan)
  525.         c=strtrim(askline("Change Directory","Enter directory name",strsub(a,b+1,strlen(a)-b-1)))
  526.         terminate(c=="","Directory Error","Directory with null name does not exist")
  527.         DirChange(c)
  528.         SetDisplay("","","")
  529.         drop(a,b,c)                       
  530.         
  531.  _&Nuke ENTIRE file/dir structure
  532.         files=FileItemize("")
  533.         numfile=ItemCount(files, " ")
  534.         totdir=0
  535.         dir1=DirGet()
  536.         sub1 = DirItemize("")
  537.         numdir1=Itemcount(sub1, " ")
  538.         if (numfile+numdir1)==0 then goto noselect
  539.         Pause("WARNING: Are you Sure :WARNING", "You are about to delete all kinds of stuff%CR%containing possibly 10 zillion files and subdirs.%CR%Continue?")
  540.         if AskYesNo("WARNING: Are you REALLY Sure :WARNING","Shall we stop now and not delete anything?")==@YES then goto quitnow
  541.         if AskYesNo("WARNING: Are you Sure :WARNING","CONTINUE???!!!??? %CR%Are you sure you can find your backups???")==@NO then goto nobackup
  542.   
  543.         if numfile > 0 then FileDelete(files)   ;Whap top level files...
  544.         If numdir1 == 0 Then Goto didit
  545.         level=1
  546.         index1=0
  547.   
  548.   
  549.         :loop
  550.         If index%level% == numdir%level% Then Goto upalevel
  551.         index%level% = index%level% + 1
  552.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  553.         totdir=totdir+1
  554.         Errormode(@off)
  555.         FileDelete("*.*")
  556.         Errormode(@cancel)
  557.         level = level + 1
  558.         dir%level% = DirGet()
  559.         sub%level% = DirItemize("*.*")
  560.         numdir%level% = ItemCount(sub%level%, " ")
  561.         index%level% = 0
  562.         goto loop
  563.   
  564.         :upalevel
  565.         a=strlen(dir%level%)                                 ;7.0S-- bug workaround
  566.         if a>3 then dir%level%=strsub(dir%level%,1,a-1)      ;ditto
  567.         DirChange(dir%level%)
  568.         DirRemove(sub%level%)
  569.         drop(dir%level%,sub%level%,index%level%,numdir%level%)
  570.         level=level-1
  571.         if level!=0 then goto loop
  572.         :didit
  573.         SetDisplay("","","")
  574.         OtherUpdate()
  575.         Display(4,"Operation Complete","Files in %totdir% subdirectories deleted")
  576.         goto done
  577.   
  578.         :noselect
  579.         Message("Sorry", "You must highlight target files/directories first.") 
  580.         goto done
  581.         :nobackup
  582.         Message("Well Then","We better not play around with nuclear devices")
  583.         goto done
  584.         :quitnow
  585.         Message("Good Thinking","A wise move. Nothing deleted")
  586.         :done
  587.         drop(files,numfile,dir1,numdir1,totdir)
  588.  
  589.  &Duplicate ENTIRE file/dir structure
  590.         Other0=OtherDir()
  591.         totdir=0
  592.         files=FileItemize("")
  593.         numfile=ItemCount(files, " ")
  594.         dir1=DirGet()
  595.         OrigDir=strsub(dir1,1,1)            ;7.0s-- bug workaround
  596.         sub1 = DirItemize("")
  597.         numdir1=Itemcount(sub1, " ")
  598.         if (numfile+numdir1)==0 then goto noselect
  599.         Other0=AskLine("Replicate structure",strcat(sub1,' ',files,CR,CR,"to"),Other0)
  600.         terminate(Other0=="" || Other0==" ","Copy Error","Cannot copy to null file name")
  601.         a=strsub(Other0,strlen(Other0),1)
  602.         if (a!=":" && a!="\") then Other0=strcat(Other0,"\")
  603.   
  604.         if numfile > 0 then FileCopy(files,Other0,@FALSE)   ;Copy top level files...
  605.         If numdir1 == 0 Then Goto didit
  606.         level=1
  607.         index1=0
  608.         ; debug(1)
  609.         :loop
  610.         If index%level% == numdir%level% Then Goto upalevel
  611.         index%level% = index%level% + 1
  612.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  613.         totdir=totdir+1
  614.         a=level-1
  615.         Other%level%=StrCat(Other%a%,ItemExtract(index%level%, sub%level%, " "),"\")
  616.         Errormode(@off)
  617.         DirMake(Other%level%)
  618.         LogDisk(Origdir)                       ;7.0s-- bug workaround
  619.         FileCopy("*.*",Other%level%,@FALSE)
  620.         Errormode(@cancel)
  621.         level = level + 1
  622.         dir%level% = DirGet()
  623.         sub%level% = DirItemize("*.*")
  624.         numdir%level% = ItemCount(sub%level%, " ")
  625.         index%level% = 0
  626.         goto loop
  627.   
  628.         :upalevel
  629.         a=strlen(dir%level%)                              ;7.0S-- Workaround
  630.         if a>3 then dir%level%=strsub(dir%level%,1,a-1)   ;7.0S-- Workaround
  631.         DirChange(dir%level%)
  632.        
  633.         drop(dir%level%,sub%level%,index%level%,Other%level%)
  634.         level=level-1
  635.         if level!=0 then goto loop
  636.         :didit
  637.         SetDisplay("","","")
  638.         OtherUpdate()
  639.         Display(4,"Duplicate Structure Complete","%totdir% directories duplicated")
  640.         goto done
  641.   
  642.         :noselect
  643.         Message("Sorry", "You must highlight source files/directories first.")
  644.         :done
  645.         drop(files,numfile,dir1,numdir1,Other0)
  646.         
  647.  &Move ENTIRE file/dir structure
  648.         Other0=OtherDir()
  649.         totdir=0
  650.         files=FileItemize("")
  651.         numfile=ItemCount(files, " ")
  652.         dir1=DirGet()
  653.         OrigDir=strsub(dir1,1,1)            ;7.0s-- bug workaround
  654.         sub1 = DirItemize("")
  655.         numdir1=Itemcount(sub1, " ")
  656.         if (numfile+numdir1)==0 then goto noselect
  657.         Other0=AskLine("Move structure",strcat(sub1,' ',files,CR,CR,"to"),Other0)
  658.         terminate(Other0=="" || Other0==" ","Move Error","Cannot move to null name")
  659.         a=strsub(Other0,strlen(Other0),1)
  660.         if (a!=":" && a!="\") then Other0=strcat(Other0,"\")
  661.   
  662.         if numfile > 0 then FileMove(files,Other0,@FALSE)   ;Copy top level files...
  663.         If numdir1 == 0 Then Goto didit
  664.         level=1
  665.         index1=0
  666.         ; debug(1)
  667.         :loop
  668.         If index%level% == numdir%level% Then Goto upalevel
  669.         index%level% = index%level% + 1
  670.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  671.         totdir=totdir+1
  672.         a=level-1
  673.         Other%level%=StrCat(Other%a%,ItemExtract(index%level%, sub%level%, " "),"\")
  674.         Errormode(@off)
  675.         DirMake(Other%level%)
  676.         LogDisk(Origdir)                       ;7.0s-- bug workaround
  677.         FileMove("*.*",Other%level%,@FALSE)
  678.         Errormode(@cancel)
  679.         level = level + 1
  680.         dir%level% = DirGet()
  681.         sub%level% = DirItemize("*.*")
  682.         numdir%level% = ItemCount(sub%level%, " ")
  683.         index%level% = 0
  684.         goto loop
  685.   
  686.         :upalevel
  687.         a=strlen(dir%level%)                              ;7.0S-- Workaround
  688.         if a>3 then dir%level%=strsub(dir%level%,1,a-1)   ;7.0S-- Workaround
  689.         DirChange(dir%level%)
  690.         DirRemove(sub%level%)
  691.         drop(dir%level%,sub%level%,index%level%,Other%level%)
  692.         level=level-1
  693.         if level!=0 then goto loop
  694.         :didit
  695.         SetDisplay("","","")
  696.         OtherUpdate()
  697.         Display(4,"Move Structure Complete","%totdir% directories moved")
  698.         goto done
  699.   
  700.         :noselect
  701.         Message("Sorry", "You must highlight source files/directories first.")
  702.         :done
  703.         drop(files,numfile,dir1,numdir1,Other0)
  704.         
  705.  &Size of ENTIRE file/dir structure
  706.         tot = FileSize(FileItemize(""))
  707.         totdir=0
  708.         level=1
  709.         dir1=DirGet()
  710.         sub1 = DirItemize("")
  711.         numdir1 = ItemCount(sub1, " ")
  712.         index1 = 0
  713.   
  714.         :loop
  715.         If index%level% == numdir%level% Then Goto upalevel
  716.         index%level% = index%level% + 1
  717.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  718.         totdir=totdir+1
  719.         tot = tot + FileSize(FileItemize("*.*"))
  720.         level = level + 1
  721.         dir%level% = DirGet()
  722.         sub%level% = DirItemize("*.*")
  723.         numdir%level% = ItemCount(sub%level%, " ")
  724.         index%level% = 0
  725.         goto loop
  726.   
  727.         :upalevel
  728.         drop(dir%level%,sub%level%,index%level%,numdir%level%)
  729.         level=level-1
  730.         if level!=0 then goto loop
  731.  
  732.         :done
  733.         ; -----------
  734.         ; Termination
  735.         ; -----------
  736.         If StrLen(tot) < 9 Then tot = StrCat(StrFill("", 9 - StrLen(tot)), tot)
  737.         tot = StrCat(StrSub(tot,1,3),",",StrSub(tot,4,3),",",StrSub(tot,7,3))
  738.         tot = StrTrim(tot)
  739.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  740.         tot = StrTrim(tot)
  741.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  742.         tot = StrTrim(tot)
  743.         Message("%totdir% Subdirecctories included", "Total size %tot% bytes.")
  744.         drop(tot,level,totdir)
  745.  
  746.  
  747.  
  748.  _&Format Diskette...
  749.         ; A wonderful example of variable substitution
  750.         D1="1) 5.25 High Density (1.2M)"
  751.         D2="2) 5.25 Standard (360K)"
  752.         D3="3) 3.5  High Density (1.44M)"
  753.         D4="4) 3.5  Standard (720K)"
  754.         D0="0) None"
  755.         DriveA=inireadpvt(CP,"DriveA","ASK",cpini)
  756.         DriveB=inireadpvt(CP,"DriveB","ASK",cpini)
  757.         if DriveA!="ASK" & DriveB!="ASK" then goto DOFORMAT
  758.  
  759.         DC="%D1%|%D2%|%D3%|%D4%|%D0%"
  760.         Message("Attention","Command Post needs to learn what kind of floppies %CR% the system has.  Please select accordingly.")
  761.         :ASKA
  762.         a=ItemSelect("Select type of Drive A",DC,"|")
  763.         if a!="" then goto OKDRIVEA
  764.         Message("You MUST select an option for A.","Please retry")
  765.         goto ASKA
  766.         :OKDRIVEA
  767.         DriveA=strsub(a,1,1)
  768.         iniwritepvt(CP,"DriveA",DriveA,cpini)
  769.  
  770.         :ASKB
  771.         a=ItemSelect("Select type of Drive B",DC,"|")
  772.         if a!="" then goto OKDRIVEB
  773.         Message("You MUST select an option for B.","Please retry")
  774.         goto ASKB
  775.         :OKDRIVEB
  776.         DriveB=strsub(a,1,1)
  777.         iniwritepvt(CP,"DriveB",DriveB,cpini)
  778.  
  779.         :DOFORMAT
  780.         A0=""
  781.         A1="1)    A:   5.25 HD (1.2M)|2)    A:   5.25 DD (360K)"
  782.         A2="2)    A:   5.25 DD (360K)"
  783.         A3="3)    A:   3.5 HD (1.44M)|4)    A:   3.5 Std (720K)"
  784.         A4="4)    A:   3.5 Standard (720K)"
  785.         B0=""
  786.         B1="5)    B:   5.25 HD (1.2M)|6)    B:   5.25 DD (360K)"
  787.         B2="6)    B:   5.25 Standard (360K)"
  788.         B3="7)    B:   3.5 HD (1.44M)|8)    B:   3.5 DD (720K)"
  789.         B4="8)    B:   3.5 DD (720K)"
  790.         FF=strcat(A%DriveA%,"|",B%DriveB%)
  791.         drop(A0,A1,A2,A3,A4,B0,B1,B2,B3,B4)
  792.  
  793.         FF=ItemSelect("Choose Format Type Desired",FF,"|")
  794.         terminate(FF=="","Format","No parameters selected")
  795.  
  796.         FF=strsub(FF,1,1)   ; FF will be 1 thru 8 (with luck)
  797.         DR=strsub("AB",(FF>4)+1,1)  ; DR is desired drive
  798.         FF=FF-((FF>4)*4)            ; FF is 1 thru 4
  799.         F11=""
  800.         F12="/4"
  801.         F22=""
  802.         F33=""
  803.         F34="/n:9 /t:80"
  804.         F44=""
  805.         DC=Drive%DR%   ; get drive type
  806.         FC=F%DC%%FF%
  807.         FC="%DR%:  %FC%"
  808.         DC=strsub(D%FF%,4,strlen(d%FF%)-3)
  809.         Pause("Attention",strcat("Preparing to format %DC%",CR,"diskette in Drive %DR% with command:",CR,"FORMAT %FC%"))
  810.         comspec=environment("COMSPEC")
  811.         run(comspec,"/c format.com %FC%")
  812.         drop(D0,D1,D2,D3,D4,DC,xxx,DriveA,DriveB)
  813.         drop(FF,DR,F11,F12,F22,F33,F34,F44,DC,FC,comspec)
  814.  
  815.  _Directory &Tree
  816.         run("%CPDIR%cp_tree.exe","")
  817.  
  818.  
  819.  
  820. &View
  821.  &Short
  822.         SetDisplay("SHORT","","")
  823.         MenuChange("ViewShort",@CHECK)
  824.         MenuChange("ViewLong",@UNCHECK)
  825.         iniwritepvt(CP,"ViewShortLong","SHORT",cpini)
  826.  &Long
  827.         SetDisplay("LONG","","")
  828.         MenuChange("ViewShort",@UNCHECK)
  829.         MenuChange("ViewLong",@CHECK)
  830.         iniwritepvt(CP,"ViewShortLong","LONG",cpini)
  831.  _&All
  832.         SetDisplay("","","*.*")
  833.         MenuChange("ViewAll",@CHECK)
  834.         MenuChange("ViewPartial",@UNCHECK)
  835.         MenuChange("ViewPrograms",@UNCHECK)
  836.         iniwritepvt(CP,"ViewWhat","ALL",cpini)
  837.  &Partial...
  838.         a=inireadpvt(CP,"Partial","*.*",cpini)
  839.         a=AskLine("View Partial","Enter types of files desired",a)
  840.         iniwritepvt(CP,"Partial",a,cpini)
  841.         SetDisplay("","",a)
  842.         MenuChange("ViewAll",@UNCHECK)
  843.         MenuChange("ViewPartial",@CHECK)
  844.         MenuChange("ViewPrograms",@UNCHECK)
  845.         iniwritepvt(CP,"ViewWhat","PARTIAL",cpini)
  846.  P&rograms
  847.         SetDisplay("","","*.EXE *.COM *.BAT *.PIF")
  848.         MenuChange("ViewAll",@UNCHECK)
  849.         MenuChange("ViewPartial",@UNCHECK)
  850.         MenuChange("ViewPrograms",@CHECK)
  851.         iniwritepvt(CP,"ViewWhat","PROGRAMS",cpini)
  852.  _By &Name
  853.         SetDisplay("","NAME","")
  854.         MenuChange("ViewByName",@CHECK)
  855.         MenuChange("ViewByDate",@UNCHECK)
  856.         MenuChange("ViewBySize",@UNCHECK)
  857.         MenuChange("ViewByKind",@UNCHECK)
  858.         MenuChange("ViewUnsorted",@UNCHECK)
  859.         iniwritepvt(CP,"ViewBy","NAME",cpini)
  860.  By &Date
  861.         SetDisplay("","DATE","")
  862.         MenuChange("ViewByName",@UNCHECK)
  863.         MenuChange("ViewByDate",@CHECK)
  864.         MenuChange("ViewBySize",@UNCHECK)
  865.         MenuChange("ViewByKind",@UNCHECK)
  866.         MenuChange("ViewUnsorted",@UNCHECK)
  867.         iniwritepvt(CP,"ViewBy","DATE",cpini)
  868.  By Si&ze
  869.         SetDisplay("","SIZE","")
  870.         MenuChange("ViewByName",@UNCHECK)
  871.         MenuChange("ViewByDate",@UNCHECK)
  872.         MenuChange("ViewBySize",@CHECK)
  873.         MenuChange("ViewByKind",@UNCHECK)
  874.         MenuChange("ViewUnsorted",@UNCHECK)
  875.         iniwritepvt(CP,"ViewBy","SIZE",cpini)
  876.  By &Kind       
  877.         SetDisplay("","KIND","")
  878.         MenuChange("ViewByName",@UNCHECK)
  879.         MenuChange("ViewByDate",@UNCHECK)
  880.         MenuChange("ViewBySize",@UNCHECK)
  881.         MenuChange("ViewByKind",@CHECK)
  882.         MenuChange("ViewUnsorted",@UNCHECK)
  883.         iniwritepvt(CP,"ViewBy","KIND",cpini)
  884.  &Unsorted
  885.         SetDisplay("","UNSORTED","")
  886.         MenuChange("ViewByName",@UNCHECK)
  887.         MenuChange("ViewByDate",@UNCHECK)
  888.         MenuChange("ViewBySize",@UNCHECK)
  889.         MenuChange("ViewByKind",@UNCHECK)
  890.         MenuChange("ViewUnsorted",@CHECK)
  891.         iniwritepvt(CP,"ViewBy","UNSORTED",cpini)
  892.  
  893.  |&1 Stack
  894.         winarrange(1)
  895.  &2 Arrange
  896.         winarrange(2)
  897.  &3 Arrange in Rows
  898.         winarrange(3)
  899.  &4 Arrange in Columns
  900.         winarrange(4)
  901.  _&5 (w/o CP) Stack
  902.         winiconize("")
  903.         winarrange(1)
  904.  &6 (w/o CP) Arrange
  905.         winiconize("")
  906.         winarrange(2)
  907.  &7 (w/o CP) Arrange in Rows
  908.         winiconize("")
  909.         winarrange(3)
  910.  &8 (w/o CP) Arrange in Cols
  911.         winiconize("")
  912.         winarrange(4)
  913.         
  914.  _Change &Wallpaper
  915.            DirChange(DirWindows(0))
  916.            a=FileItemize("*.BMP")
  917.            a=strcat("-None- ",a)
  918.            a=ItemSelect("Select New Wallpaper",a," ")
  919.            terminate(a=="","Wallpaper","No wallpaper selected")
  920.            if a=="-None-" then Wallpaper("",0)
  921.            if a=="-None-" then exit
  922.            tile=@FALSE
  923.            if FileSize(a)<40000 then tile=@TRUE  
  924.            ;if bmp size less than 40K, assume tile, else center
  925.            Wallpaper(a,tile)
  926.            drop(a,tile)
  927.  
  928.  
  929. &Main
  930.  &Command Post (More Windows)
  931.        a=IntControl(2,0,0,0,0)      ; retrieves number of open CmdPost Windows
  932.        if a==4 then goto posit
  933.           DirChange(CPDIR)
  934.           run("cmdpost.exe","")
  935.           exit
  936.        :posit
  937.           IntControl(6,0,0,0,0)   ;Repositions all open cp windows
  938.  Command &Post (Show All Windows)
  939.           IntControl(6,0,0,0,0)   ;Repositions all open cp windows
  940.        
  941.  Control &Panel
  942.         errormode(@off)
  943.         terminate(winactivate("Control Panel"),"","")
  944.         errormode(@cancel)
  945.         run("control.exe","")
  946.  
  947.  C&lipboard
  948.         errormode(@off)
  949.         terminate(winactivate("Clipboard"),"","") ;Already Running
  950.         errormode(@cancel)
  951.         run("Clipbrd.exe","")
  952.  
  953.  &DOS Prompt
  954.         run(Environment("COMSPEC"),"")
  955.  
  956.  _Get WIL &Help
  957.            run("winhelp.exe","%CPDIR%wil.hlp")
  958.  
  959.  _Preferences
  960.   Show System/Hidden Files
  961.         a=strupper(inireadpvt(CP,"SysHide","0",cpini))
  962.         c="YES"
  963.         if a==0 then c="NO"
  964.         b=AskYesNo("System/Hidden Files","Show System and Hidden files?%CR%Current answer=%c%%CR%Enter desired answer")
  965.         if a!=b then iniwritepvt(CP,"SysHide",b,cpini)
  966.         IntControl(5,b,0,0,0)                 ;Controls system/hidden show flag
  967.         SetDisplay("","","")
  968.  
  969.   Save CmdPost Window Positions
  970.         c=IntControl(2,0,0,0,0)     ;This guy returns # of CP Windows open
  971.         b1="Do you wish to save the current CmdPost"
  972.         b2="window positions for future startups?"
  973.         b3="Note: You can save positions of combinations"
  974.         b4="of 1, 2, 3, and 4 window positions."
  975.         b5="Now saving window positions for %c% windows"
  976.         b1=strcat(b1,CR,b2,CR,CR,b3,CR,b4,CR,b5)
  977.         drop(b2,b3,b4,b5)
  978.         a=AskYesNo("CmdPost Window Positions",b1)
  979.         if a==@YES then IntControl(3,0,0,0,0) ;This causes all cp's to write
  980.         exit                                  ;their position information
  981.  
  982.   Printer Options
  983.         iniwritepvt(CP,"TextPrinter","ASK",cpini)
  984.         MenuChange("FilePrint",@ENABLE)
  985.         b1="CmdPost's saved information reset."
  986.         b2="You will be prompted to re-enter the"
  987.         b3="necessary information when it is required."
  988.         b1=strcat(b1,CR,b2,CR,b3)
  989.         Message("Information Reset",b1)
  990.  
  991.   Floppy Options
  992.         iniwritepvt(CP,"DriveA","ASK",cpini)
  993.         iniwritepvt(CP,"DriveB","ASK",cpini)
  994.         b1="CmdPost's saved information reset."
  995.         b2="You will be prompted to re-enter the"
  996.         b3="necessary information when it is required."
  997.         b1=strcat(b1,CR,b2,CR,b3)
  998.         Message("Information Reset",b1)
  999.  
  1000.  
  1001.   Auto Run= and Load= Options
  1002.         a=strupper(inireadpvt(CP,"AutoStart","NO",cpini))
  1003.         b=AskYesNo("Auto Startup from WIN.INI","Auto start from WIN.INI RUN= and LOAD= lines?%CR%Current answer=%a%%CR%Enter desired answer")
  1004.         if b==@YES then b=AskYesNo("Auto Startup from WIN.INI","Generally this option is set only%CR%when you make CmdPost your shell.%CR%Continue?")
  1005.         if b==@NO then b="NO"
  1006.         if b==@YES then b="YES"
  1007.         if a!=b then iniwritepvt(CP,"AutoStart",b,cpini)
  1008.         
  1009.   CmdPost Window Titles
  1010.    Window 1
  1011.         c=strcat("Command Post ",version()," #")
  1012.         a=1
  1013.         Title%a%=inireadpvt(CP,"Title%a%","%c%%a%",cpini)
  1014.         b=AskLine("CmdPost Title #%a%","Enter name of #%a% CmdPost window.",Title%a%)
  1015.         iniwritepvt(CP,"Title%a%",b,cpini)
  1016.         if WinExist(Title%a%) then WinTitle(Title%a%,b)
  1017.    Window 2
  1018.         c=strcat("Command Post ",version()," #")
  1019.         a=2
  1020.         Title%a%=inireadpvt(CP,"Title%a%","%c%%a%",cpini)
  1021.         b=AskLine("CmdPost Title #%a%","Enter name of #%a% CmdPost window.",Title%a%)
  1022.         iniwritepvt(CP,"Title%a%",b,cpini)
  1023.         if WinExist(Title%a%) then WinTitle(Title%a%,b)
  1024.    Window 3
  1025.         c=strcat("Command Post ",version()," #")
  1026.         a=3
  1027.         Title%a%=inireadpvt(CP,"Title%a%","%c%%a%",cpini)
  1028.         b=AskLine("CmdPost Title #%a%","Enter name of #%a% CmdPost window.",Title%a%)
  1029.         iniwritepvt(CP,"Title%a%",b,cpini)
  1030.         if WinExist(Title%a%) then WinTitle(Title%a%,b)
  1031.    Window 4
  1032.         c=strcat("Command Post ",version()," #")
  1033.         a=4
  1034.         Title%a%=inireadpvt(CP,"Title%a%","%c%%a%",cpini)
  1035.         b=AskLine("CmdPost Title #%a%","Enter name of #%a% CmdPost window.",Title%a%)
  1036.         iniwritepvt(CP,"Title%a%",b,cpini)
  1037.         if WinExist(Title%a%) then WinTitle(Title%a%,b)
  1038.  
  1039.   View Startup Options
  1040.         a=strupper(inireadpvt(CP,"ViewSetup","NO",cpini))
  1041.         b=AskYesNo("Remember View options","Should View menu options be remembered?%CR%Current answer=%a%%CR%Enter desired answer")
  1042.         if b==@NO then b="NO"
  1043.         if b==@YES then b="YES"
  1044.         if a!=b then iniwritepvt(CP,"ViewSetup",b,cpini)
  1045.         
  1046.   Editor Options
  1047.         Editor=strtrim(strupper(AskLine("Editor Selection","Enter desired editor",Editor)))
  1048.         iniwritepvt(CP,"Editor",Editor,cpini)
  1049.           
  1050.   File Refresh
  1051.    On
  1052.            IniWritePvt(CP,"AutoUpdate",1,cpini)
  1053.            MenuChange("MainPreferencesFileRefreshOn",@CHECK)
  1054.            MenuChange("MainPreferencesFileRefreshOff",@UNCHECK)
  1055.    Off
  1056.            IniWritePvt(CP,"AutoUpdate",0,cpini)
  1057.            MenuChange("MainPreferencesFileRefreshOn",@UNCHECK)
  1058.            MenuChange("MainPreferencesFileRefreshOff",@CHECK)
  1059.            
  1060.   Default startup program
  1061.            a=IniRead("Extensions","*","Browser.exe")         
  1062.            a=AskLine("Default startup program","Enter program to run for file when%CR%file extension is not defined",a)
  1063.            iniwrite("Extensions","*",a)
  1064.    
  1065.           
  1066.  _Run "Managers"           
  1067.  
  1068.   P&rogram Manager
  1069.         errormode(@off)
  1070.         terminate(winactivate("Program Manager"),"","") ;Already Running
  1071.         errormode(@cancel)
  1072.         run("Progman.exe","")
  1073.  
  1074.   &File Manager
  1075.         errormode(@off)
  1076.         terminate(winactivate("File Manager"),"","") ;Already Running
  1077.         errormode(@cancel)
  1078.         run("winfile.exe","")
  1079.  
  1080.   Print &Manager
  1081.         run("printman.exe","")   ; takes care of itself
  1082.  
  1083.  
  1084.  _Edit Configurations
  1085.   &Edit CmdPost menus
  1086.    CMDPOST.CPM
  1087.            DirChange(FilePath(FileLocate("%CPDIR%CMDPOST.CPM")))
  1088.            a="CMDPOST.CPM"
  1089.  
  1090.            ;it it already running???  Find it...
  1091.            b=WinItemize()
  1092.            bup=StrUpper(b)
  1093.            c=ItemCount(bup,tab)
  1094.            d=0
  1095.            :woop
  1096.            if c==d then goto doit
  1097.            d=d+1
  1098.            e=itemextract(d,bup,tab)
  1099.            if strindex(e,a,0,@FWDSCAN)==0 then goto woop
  1100.            e=itemextract(d,b,tab)
  1101.            WinActivate(e)
  1102.            goto goombye
  1103.            
  1104.            :doit
  1105.            bup=strcat( FileRoot(a),".BAK")
  1106.            FileCopy(a,bup,@FALSE);
  1107.            run(Editor,a)
  1108.            :goombye
  1109.            drop(a,b,c,d,e,bup)
  1110.    CMDUSER.CPM
  1111.            DirChange(FilePath(FileLocate("%CPDIR%CMDPOST.CPM")))
  1112.            a="CMDUSER.CPM"
  1113.  
  1114.            ;it it already running???  Find it...
  1115.            b=WinItemize()
  1116.            bup=StrUpper(b)
  1117.            c=ItemCount(bup,tab)
  1118.            d=0
  1119.            :woop
  1120.            if c==d then goto doit
  1121.            d=d+1
  1122.            e=itemextract(d,bup,tab)
  1123.            if strindex(e,a,0,@FWDSCAN)==0 then goto woop
  1124.            e=itemextract(d,b,tab)
  1125.            WinActivate(e)
  1126.            goto goombye
  1127.            
  1128.            :doit
  1129.            bup=strcat( FileRoot(a),".BAK")
  1130.            FileCopy(a,bup,@FALSE);
  1131.            run(Editor,a)
  1132.            :goombye
  1133.            drop(a,b,c,d,e,bup)
  1134.  
  1135.   Edit &INI files
  1136.         DirChange(DirWindows(0))
  1137.         canned="BYEBYE"
  1138.         IniFiles=""
  1139.  
  1140.         :UP1
  1141.         canned="byebye"
  1142.         If IniFiles!="" then goto inied
  1143.         IniFiles=FileItemize("*.INI")
  1144.         :inied
  1145.         TheFile=ItemSelect("Choose Desired INI file",IniFiles," ")
  1146.         if TheFile=="" then goto newini
  1147.         Sections=""
  1148.  
  1149.         :UP2
  1150.         canned="up1"
  1151.         if Sections!="" then goto sected
  1152.         Sections=IniItemizePvt("",TheFile)
  1153.         :SECTED
  1154.         Section=ItemSelect("%TheFile% - Choose Section",Sections,TAB)
  1155.         if Section=="" then goto AddSect
  1156.         KeyValues=""
  1157.  
  1158.         :UP3
  1159.         canned="up2"
  1160.         if KeyValues!="" then goto looped
  1161.         Keys=IniItemizePvt(Section,TheFile)
  1162.         KeyMax=ItemCount(Keys,TAB)
  1163.         KeyIndex=0
  1164.  
  1165.         :Loop
  1166.         if KeyIndex==KeyMax then goto looped
  1167.         KeyIndex=KeyIndex+1
  1168.         ThisKey=ItemExtract(KeyIndex,Keys,TAB)
  1169.         ThisValue=IniReadPvt(Section,ThisKey,"???",TheFile)
  1170.         KeyValues=strcat(KeyValues,ThisKey,"= ",ThisValue,TAB)
  1171.         goto Loop
  1172.  
  1173.         :looped
  1174.         Key=ItemSelect("%TheFile% [%Section%] - Choose Keyword",KeyValues,TAB)
  1175.         if Key=="" then goto AddKey
  1176.         Key=ItemExtract(1,Key,"=")
  1177.  
  1178.         Value=IniReadPvt(Section,Key,"???",TheFile)
  1179.         goto entkey
  1180.  
  1181.  
  1182.         :newini
  1183.         canned="UP1"
  1184.         TheFile=Askline("Making NEW INI file","Enter new INI file name","*.INI")
  1185.         if (TheFile=="*.INI" || TheFile=="") then goto newini
  1186.         IniFIles=""
  1187.         goto AddSectNewIni
  1188.  
  1189.         :AddSect
  1190.         canned="up2"
  1191.         :AddSectNewIni
  1192.         Section=AskLine("Add New Section to INI File","Enter new section name for%CR%   %TheFile%%CR%      [?????]","")
  1193.         Sections=""
  1194.         goto AddKeyNewSect
  1195.  
  1196.         :AddKey
  1197.         canned="up3"
  1198.         :AddKeyNewSect
  1199.         Key=AskLine("Add New Keyword to INI File","Enter new key name for%CR%   %TheFile%%CR%      [%Section%]","")
  1200.         Value="(Undefined)"
  1201.         KeyValues=""
  1202.         goto EntKeyNewKey
  1203.  
  1204.         :ENTKEY
  1205.         canned="up3"
  1206.         :EntKeyNewkey
  1207.         NewValue=AskLine("Modify INI File Keyword","%TheFile%%CR%   [%Section%]%CR%      %Key% = %Value%",Value)
  1208.         if NewValue!=Value then iniwritepvt(Section,Key,NewValue,TheFile)
  1209.         KeyValues=""
  1210.         goto up3
  1211.  
  1212.         :CANCEL
  1213.         goto %Canned%
  1214.  
  1215.         :BYEBYE
  1216.         exit
  1217.  
  1218.  
  1219.   Run System Confi&guration Editor
  1220.            run("sysedit.exe","")  ;takes care of itself
  1221.   Run Windows Setup
  1222.         DirChange(DirWindows(0))
  1223.         run("setup.exe","")
  1224.         drop(a)
  1225.   Restart Windows
  1226.    NO! Wait
  1227.         Display(4,"OK","I'll wait")
  1228.    Really! Doit!
  1229.         IntControl(66,0,0,0,0)
  1230.         
  1231.            
  1232.  
  1233.   _PIF Edi&t...
  1234.         a=strupper(FileExtension(CurrentFile()))
  1235.         if a!="PIF" then goto PIF2
  1236.         run("pifedit.exe",CurrentFile())
  1237.         exit
  1238.         :PIF2
  1239.         if IsKeyDown(@SHIFT)==@YES then DirChange(FilePath(FileLocate("_default.pif")))
  1240.         a=FileItemize("*.PIF")
  1241.         if a==""  then DirChange(FilePath(FileLocate("_default.pif")))
  1242.         if a=="" then a=FileItemize("*.PIF")
  1243.         a=ItemSelect("Choose a PIF File to edit",a," ")
  1244.         run("pifedit.exe",a)
  1245.         exit
  1246.  
  1247.  _&System Information
  1248.        wintype="retail"
  1249.        if WinMetrics(22) then wintype="debug"
  1250.  
  1251.         wc=WinConfig()
  1252.         if !(wc&1) then mode="Real"
  1253.         if wc&16 then mode="Standard"
  1254.         if wc&32 then mode="Enhanced"
  1255.  
  1256.         if wc&2 then cpu=286
  1257.         if wc&4 then cpu=386
  1258.         if wc&8 then cpu=486
  1259.         if wc&64 then cpu=8086
  1260.         if wc&128 then cpu=80186
  1261.  
  1262.         Sysinfo=strcat(cpu,' ',mode,' ',wintype,' Windows ',WinVersion(1),'.',WinVersion(0),CR)
  1263.  
  1264.         math="No math"
  1265.         if wc&1024 then math="Math"
  1266.         mouse="No Mouse"
  1267.         if WinMetrics(19) then mouse="Mouse"
  1268.  
  1269.         Sysinfo=strcat(sysinfo,math," co-processor.   ",mouse,' available.',CR)
  1270.  
  1271.         sysinfo=strcat(sysinfo,WinMetrics(0),'x',WinMetrics(1)," video resolution.  ",WinMetrics(-1),"  colors.",CR)
  1272.  
  1273.         ErrorMode(@OFF)
  1274.         LastError()
  1275.         PlayMedia("Status WaveForm Ready")
  1276.         ErrorMode(@CANCEL)
  1277.         if LastError()!=1193 then sysinfo=strcat(sysinfo,"Windows multimedia extensions present.",CR)
  1278.  
  1279.         bug=NetGetCaps(2)
  1280.         if bug==0 then math="No n"
  1281.         if bug!=0 then math="N"
  1282.         if bug==256 then math="Microsoft n"
  1283.         if bug==512 then math="Lan Manager n"
  1284.         if bug==768 then math="Novell NetWare n"
  1285.         if bug==1024 then math="Banyan Vines n"
  1286.         if bug==1280 then math="10 Net n"
  1287.         sysinfo=strcat(sysinfo,math,"etwork installed.",CR)
  1288.  
  1289.         bug=WinResources(0)/1024   ; Compute memory avail
  1290.         math=strlen(bug)
  1291.         if math>3 then bug=strcat(strsub(bug,1,math-3),',',strsub(bug,math-2,3))
  1292.  
  1293.         sysinfo=strcat(sysinfo,CR,bug," KB Free Memory",CR)
  1294.         sysinfo=strcat(sysinfo,WinResources(2),"%% System Resources Free (",WinResources(3),"%% GDI, ",WinResources(4),"%% User)",CR)
  1295.  
  1296.         sysinfo=strcat(sysinfo,"DOS ",DosVersion(1),'.',DosVersion(0),"  using ",environment("COMSPEC"),CR)
  1297.         disks=DiskScan(1)
  1298.         if disks!="" then sysinfo=strcat(sysinfo,"Floppies ",disks,CR)
  1299.         disks=DiskScan(2)
  1300.         if disks!="" then sysinfo=strcat(sysinfo,"Hard Disks ",disks,CR)
  1301.         disks=DiskScan(4)
  1302.         if disks!="" then sysinfo=strcat(sysinfo,"Network Disks ",disks,CR)
  1303.         sysinfo=strcat(sysinfo,"Windows Directory ",DirWindows(0),CR)
  1304.         sysinfo=strcat(sysinfo,"System  Directory ",DirWindows(1),CR)
  1305.  
  1306.         ver=Version()
  1307.         Message("Command Post %ver% SysInfo",Sysinfo)
  1308.  
  1309.  
  1310.  
  1311.     
  1312.